cmake_minimum_required(VERSION 3.16)

project(CNC_Double_Head_Saw VERSION 0.1 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(Qt6 REQUIRED COMPONENTS Quick Sql SerialBus SerialPort Network Widgets)
find_package(Qt6 REQUIRED COMPONENTS Core)
find_package(Qt6 REQUIRED COMPONENTS LinguistTools)
find_package(Qt6 REQUIRED COMPONENTS Core)
find_package(Qt6 REQUIRED COMPONENTS Core)
find_package(Qt6 REQUIRED COMPONENTS Core)

qt_standard_project_setup(REQUIRES 6.8)

set(CMAKE_AUTOMOC on)

qt_add_executable(appCNC_Double_Head_Saw
    main.cpp
)

qt_add_qml_module(appCNC_Double_Head_Saw
    URI CNC_Double_Head_Saw
    VERSION 1.0
    SOURCES applicatonengine.h applicatonengine.cpp
    SOURCES Choose_Material_Height/materialheightdatabase.h Choose_Material_Height/materialheightdatabase.cpp
    SOURCES Choose_Material_Height/material_height_manager.h Choose_Material_Height/material_height_manager.cpp
    SOURCES sqlite_pool.h sqlite_pool.cpp
    SOURCES Order_Process_DataBase/order_processdatabase.h Order_Process_DataBase/order_processdatabase.cpp
    SOURCES Order_Process_DataBase/order_process_manager.h Order_Process_DataBase/order_process_manager.cpp
    SOURCES modbuscontrol.h modbuscontrol.cpp
    SOURCES config.h config.cpp
    SOURCES scannercontrol.h scannercontrol.cpp
    SOURCES printercontrol.h printercontrol.cpp
    SOURCES netmanager.h netmanager.cpp
    SOURCES languagecontrol.h languagecontrol.cpp
    QML_FILES
        #Root.qml
        QML_FILES A_Button.qml
        A_Dialog.qml
        A_Label.qml
        A_Popup.qml
        A_TextInput.qml
        AnyLocationSettingWindow.qml
        ConfigDeviceWindow.qml
        ConnectSettingWindow.qml
        Corner_Process.qml
        ExtraLong_Process.qml
        ExtraShort_Process.qml
        HeightChooseWindow.qml
        HoldSettingWindow.qml
        IO_Monitor_Window.qml
        LocationSettingWindow.qml
        Manager_And_Setting_Process.qml
        ManualProcessWindow.qml
        MechineAngle.qml
        MechineParameterWindow.qml
        NetWork_Process.qml
        Order_Process.qml
        PasswordSettingWindow.qml
        PrinterSettingWindow.qml
        QRCode_Process.qml
        Root.qml
        ServoSettingWindow.qml
        SOURCES Mid_Struct.h
        SOURCES
        SOURCES cutdatamodel.h cutdatamodel.cpp
        SOURCES usb_processlist_model.h usb_processlist_model.cpp
        QML_FILES USB_Process_Window.qml
        QML_FILES A_NumberInput.qml
        QML_FILES A_NumberKeyboard.qml
)

# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
# If you are developing for iOS or macOS you should consider setting an
# explicit, fixed bundle identifier manually though.
set_target_properties(appCNC_Double_Head_Saw PROPERTIES
#    MACOSX_BUNDLE_GUI_IDENTIFIER com.example.appCNC_Double_Head_Saw
    MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
    MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
    MACOSX_BUNDLE TRUE
    WIN32_EXECUTABLE TRUE
)

target_link_libraries(appCNC_Double_Head_Saw
    PRIVATE Qt6::Quick
    PRIVATE Qt6::Sql
    PRIVATE Qt6::SerialBus
    PRIVATE Qt6::SerialPort
    PRIVATE Qt6::Network
    PRIVATE Qt6::Widgets
)
target_link_libraries(appCNC_Double_Head_Saw PRIVATE Qt6::Core)
target_link_libraries(appCNC_Double_Head_Saw PRIVATE Qt6::Core)
target_link_libraries(appCNC_Double_Head_Saw PRIVATE Qt6::Core)
target_link_libraries(appCNC_Double_Head_Saw PRIVATE Qt6::Core)

include(GNUInstallDirs)
install(TARGETS appCNC_Double_Head_Saw
    BUNDLE DESTINATION .
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
